package cn.itcast.bos.repository;

import cn.itcast.bos.domain.base.Standard;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Think on 2017/9/14.
 */
public interface StandardRepository extends JpaRepository<Standard,Integer> {
    List<Standard> findByName(String name);

    List<Standard> findByNameLike(String s);

    // nativeQuery=false 配置JPQL（类似于HQL） 、 nativeQuery=true 配置SQL
    @Query(value = "from Standard where name = ?",nativeQuery = false)
    List<Standard> queryName(String s);

    @Query
    List<Standard> queryName2(String s);

    @Query(value = "update Standard set minLength=?2 where id=?1")
    @Modifying
    void updateMinlength(Integer id,Integer minLength);
}
